<template>
  <div class="wraper">
    <swiper :options="swiperOption" v-if="showSwiper">
      <swiper-slide v-for="item of list" :key="item.id">
        <img :src="item.imgUrl" class="swiper-img"/>
      </swiper-slide>
      <div class="swiper-pagination" slot="pagination"/>
    </swiper>
  </div>
</template>
<script>
  export default {
    name: 'HomeSwiper',
    props: {
      list: Array
    },
    data: function () {
      return {
        swiperOption: {
          pagination: '.swiper-pagination',
          // autoplay:true
        }
      }
    },
    computed: {
      showSwiper: function () {
        return this.list.length
      }
    }
  }
</script>
<style lang="stylus" scoped>
  .wraper >>> .swiper-pagination-bullet-active {
    background: #ffffff
  }

  .wraper {
    width: 100%;
    height: 0;
    overflow: hidden;
    padding-bottom: 32.25%;
    background: #eee;
  }

  .swiper-img {
    width: 100%;
  }
</style>
